<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('导出设置')" />
    <th:block th:include="include :: select2-css" />
</head>
<body>
<div class="main-content">
    <form class="form-horizontal" id="form-employee-edit" >
        <input name="employeeId"  type="hidden" />
        <input name="deptId"  type="hidden" />
        <h4 class="form-header h4">导出选项</h4>

        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="report-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                名字：<input type="text" name="staffName"/>
                            </li>
                            <li>
                                在位情况：<select name="staffStatus">
                                <option value="">请选择在位情况</option>
                                <option value="在岗">在岗</option>
                                <option value="出差">出差</option>
                                <option value="请假">请假</option>
                                <option value="调休">调休</option>
                            </select>
                            </li>
                            <li class="select-time">
                                <label>时间范围： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="startTime"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="updateTime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;导出</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
        </div>

    </form>
</div>

<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script type="text/javascript">
    var prefix = ctx + "system/employee";

    $("#form-user-edit").validate({
        onkeyup: false,
        rules:{
            email:{
                email:true,
                remote: {
                    url: prefix + "/checkEmailUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "userId": function() {
                            return $("#userId").val();
                        },
                        "email": function() {
                            return $.common.trim($("#email").val());
                        }
                    },
                    dataFilter: function (data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
            phonenumber:{
                isPhone:true,
                remote: {
                    url: prefix + "/checkPhoneUnique",
                    type: "post",
                    dataType: "json",
                    data: {
                        "userId": function() {
                            return $("#userId").val();
                        },
                        "phonenumber": function() {
                            return $.common.trim($("#phonenumber").val());
                        }
                    },
                    dataFilter: function (data, type) {
                        return $.validate.unique(data);
                    }
                }
            },
        },
        messages: {
            "email": {
                remote: "Email已经存在"
            },
            "phonenumber":{
                remote: "手机号码已经存在"
            }
        },
        focusCleanup: true
    });

    function submitHandler() {
        var data = $("#form-employee-edit").serializeArray();
        var postIds = $.form.selectSelects("post");
        data.push({"name": "postIds", "value": postIds});
        $.operate.saveTab(prefix + "/edit", data);
    }

    /* 用户管理-修改-选择部门树 */
    function selectDeptTree() {
        var deptId = $.common.isEmpty($("#treeId").val()) ? "1" : $("#treeId").val();
        var url = ctx + "system/dept/selectDeptTree/" + deptId;
        var options = {
            title: '选择部门',
            width: "380",
            url: url,
            callBack: doSubmit
        };
        $.modal.openOptions(options);
    }

    function doSubmit(index, layero){
        var tree = layero.find("iframe")[0].contentWindow.$._tree;
        var body = layer.getChildFrame('body', index);
        $("#treeId").val(body.find('#treeId').val());
        $("#treeName").val(body.find('#treeName').val());
        layer.close(index);
    }

    $(function() {
        $('#post').select2({
            placeholder: "请选择岗位",
            allowClear: true
        });
    })
</script>
</body>
</html>